﻿@using ZX.Tools
@using ZX.Model
@model MyClock
@{
    Sys_UserModel user = ViewBag.User;
    List<Sys_User> userList = ViewBag.UserList ?? new List<Sys_User>();
}
<link href="~/Static/styles/bootstrap.min.css" rel="stylesheet" />
<link href="~/Static/js/layui/css/layui.css" rel="stylesheet" />
<script src="/Static/js/jquery/jquery-1.11.1.min.js"></script>
<script src="~/Static/js/layui/layui.js"></script>
<div class='row page-content'>
    <div class='panel'>
        <div class='panel-heading'><strong><i class='icon-building'></i>未打卡证明审批单</strong></div>
        <div class='panel-body'>
            <form action="/MyClock/SaveApproval" method="post" class="form" id="formMyClock">
                <input type="hidden" name="Id" value="@Model.Id" />
                <input type="hidden" name="FK_ApprovalId" value="@Model.FK_ApprovalId" />
                <input type="hidden" name="status" value="@ApplyStatus.驳回.ToInt()" />
                <input type="hidden" name="deptId" value="@user.Fk_DeptId" />
                <table class='table table-bordered' style="border: 1px solid #ddd;">
                    <tr>
                        <th class='text-center w-150px'>姓名</th>
                        <td>
                            @user.RealName
                        </td>
                        <th class="text-center w-100px">部门</th>
                        <td>
                            @user.DeptName
                        </td>
                        <th class='text-center w-100px'>职位</th>
                        <td>
                            @user.PositionName
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center">未打卡次数</th>
                        <td colspan="5">
                            @(Model.NoClockCount < 4 ? Model.NoClockCount + "次" : "超过3次")
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center">第一次未打卡日期</th>
                        <td>@Model.OneDate.ToDateFormat("yyyy-MM-dd")</td>
                        <th class="text-center">因由</th>
                        <td colspan="3">
                            @Model.OneDesc
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center">第二次未打卡日期</th>
                        <td>@Model.TwoDate.ToDateFormat("yyyy-MM-dd")</td>
                        <th class="text-center">因由</th>
                        <td colspan="3">
                            @Model.TwoDesc
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center">第三次未打卡日期</th>
                        <td>@Model.ThreeDate.ToDateFormat("yyyy-MM-dd")</td>
                        <th class="text-center">因由</th>
                        <td colspan="3">
                            @Model.ThreeDesc
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center">超过三次未打卡日期</th>
                        <td>@Model.OutThreeDate.ToDateFormat("yyyy-MM-dd")</td>
                        <th class="text-center">因由</th>
                        <td colspan="3">
                            @Model.OutThreeDesc
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6">
                            <strong>部门负责人签字:</strong>
                            <div>
                                @{
                                    string userSign0 = "";
                                    string yymmdd0 = "";

                                    try
                                    {
                                        userSign0 = userList[0].USgin;
                                        DateTime applyTime0 = Convert.ToDateTime(userList[0].CreateTime);
                                        yymmdd0 = applyTime0.Year + "年" + applyTime0.Month + "月" + applyTime0.Day + "日";
                                    }
                                    catch { }
                                    //如果申请单只走部门负责人审批,则仅仅显示部门负责人
                                    if (userSign0.IsNotNullOrEmpty())
                                    {
                                        <img src="@userSign0" style="width:200px;height:50px;margin-left:7px;" /><br />
                                        <label style="float:right">@yymmdd0</label>
                                    }
                                }
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        onprint();
    });
    function printHtml(html) {
        var bodyHtml = html;
        document.body.innerHTML = html;
        window.print();
        document.body.innerHTML = bodyHtml;
    }
    function onprint() {
        var html = $(".panel-body").html();
        printHtml(html);
    }
</script>